package com.cs.study.homework._0206;

import java.util.Arrays;
import java.util.Scanner;

public class Score {
    public static void main(String[] args) {
        System.out.println("请输入学生的成绩：");
        Scanner sc = new Scanner(System.in);
        double[] arr = new double[10];
        for (int i = 0; i < 10; i++) {
            double score = sc.nextDouble();
            arr[i] = score;
        }
        System.out.println("学生的成绩依次是:" + Arrays.toString(arr));
        double average = getAverage(arr);
        System.out.println("成绩平均分是" + average + "分");
    }

    //得到平均值
    public static double getAverage(double[] arr) {
        double sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        return sum / 10;
    }
}
